package jgl.vajra.kingkong.widget.base;

import jgl.vajra.kingkong.widget.mvvm.viewmodel.BaseViewModel;
import com.orhanobut.logger.Logger;

import androidx.databinding.ViewDataBinding;

public abstract class BaseRequestDataFragment<VM extends BaseViewModel, D extends ViewDataBinding > extends BasePageManageFragment<VM, D>   {
    protected boolean isFirstRequestData = true;

    @Override
    protected void requestNetData() {
        onRequestNetData();
        isFirstRequestData = false;
    }

    public abstract void onRequestNetData();

    public void onRefreshNetData() {

    }

    @Override
    public void onResume() {
        super.onResume();
        if (isInitFragment) {
            if (isFirstRequestData) {
                Logger.d("isFirstRequestData requestNetData");
                requestNetData();
            } else {
                Logger.d("isFirstRequestData onRefreshNetData");
                onRefreshNetData();
            }
        }

    }


}
